# Maintainer: Antonio Rojas <arojas@archlinux.org> 

pkgname=discover
pkgver=5.22.5
pkgrel=2
pkgdesc='KDE and Plasma resources management GUI'
arch=(x86_64)
url='https://kde.org/plasma-desktop/'
license=(LGPL)
depends=(knewstuff kitemmodels kcmutils kidletime qt5-graphicaleffects appstream-qt archlinux-appstream-data
         hicolor-icon-theme kirigami2 discount kuserfeedback)
makedepends=(extra-cmake-modules plasma-framework packagekit-qt5 flatpak fwupd)
optdepends=('packagekit-qt5: to manage packages from Arch Linux repositories' 'flatpak: Flatpak packages support'
            'fwupd: firmware update support')
groups=(plasma)
source=(https://download.kde.org/stable/plasma/$pkgver/$pkgname-$pkgver.tar.xz{,.sig}
        discover-no-kcm.patch::https://invent.kde.org/plasma/discover/-/commit/725ae1f2.patch
        https://invent.kde.org/plasma/discover/-/commit/c829aa67.patch)
sha256sums=('c9809ec8f3f26909ce9901d6f7cd03cf52d4854431cfdf5340a4daa8404842b0'
            'SKIP'
            '23de6e2ce77324d84dffb36955a8cee7c32b4ff2f1ff003291773894bc23dc07'
            '3bfdf8e2220cdfa1a73474e64e656e563149199b7cdb237c07eddc6a0417cc79')
validpgpkeys=('2D1D5B0588357787DE9EE225EC94D18F7F05997E'  # Jonathan Riddell <jr@jriddell.org>
              '0AAC775BB6437A8D9AF7A3ACFE0784117FBCE11D'  # Bhushan Shah <bshah@kde.org>
              'D07BD8662C56CB291B316EB2F5675605C74E02CF'  # David Edmundson <davidedmundson@kde.org>
              '1FA881591C26B276D7A5518EEAAF29B42A678C20') # Marco Martin <notmart@gmail.com>

prepare() {
  patch -d $pkgname-$pkgver -p1 < discover-no-kcm.patch # Don't build KCM
  patch -d $pkgname-$pkgver -p1 < c829aa67.patch # Fix uninstalling packages with PK 1.2.4
}

build() {
  cmake -B build -S $pkgname-$pkgver \
    -DCMAKE_INSTALL_LIBEXECDIR=lib \
    -DBUILD_TESTING=OFF \
    -DWITH_KCM=OFF
  cmake --build build
}

package() {
  DESTDIR="$pkgdir" cmake --install build
}
